﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Reflection;
using System.Diagnostics;
using System.IO;

namespace Updater
{
    using Common;
    public class UpdaterHelper
    {
        public static void CheckUpdate()
        {
            Assembly assembly = AssemblyHelper.GetCallingAssembly();
            CheckUpdate(Common.AssemblyHelper.GetName(assembly), Common.AssemblyHelper.GetArchitecture(assembly).ToString(), Common.AssemblyHelper.GetVersion(assembly).ToString());
        }

        public static void CheckUpdate(string software, string architecture, string current_version)
        {
            string[] values = new string[] { software, architecture, current_version };

            try
            {
                Process.Start(AssemblyHelper.Location(), string.Format("\"{0}\"", string.Join("\" \"", values)));
            }
            catch { }
        }
    }
}
